﻿#pragma once

#include <QMainWindow>

#include "mainwindow.h"
#include "shell/softetherclient.h"

namespace Ui {
class WindowLogin;
}

class WindowLogin : public QMainWindow {
    Q_OBJECT

public:
    explicit WindowLogin(QWidget *parent = nullptr);
    ~WindowLogin();

public slots:
    void tryLogin();
    bool tryLogout();
    void cleanVpn();

    void showForm();
    void closeForm();

private:
    void stateChanged(QString msg);
    void loginFinish(bool loginOK);
    void logoutOK();
private slots:
    void on_btnLogin_clicked();
    void on_chbAutoLogin_clicked();

private:
    bool loadConfig();
    void resetForm();
private:
    Ui::WindowLogin *ui;
    MainWindow m_main;
    SoftEtherClient m_client;
    bool m_connected;
};
